package worldinruin.core;

import java.beans.PropertyChangeListener;
import java.util.Set;


public interface ITroop {

	/**
	 * Gets the owner of the troop, the player.
	 * @return Player who owns this troop.
	 */
	IPlayer getPlayer();

	/**
	 * Gets the tile the troops is currently positioned.
	 * @return Tile of troops position.
	 */
	ITile getPosition();

	/** Tries to remove the specified amount of ISoldiers from the troop.
	 * @param soldier The soldier type
	 * @param amount The amount to be removed
	 * @return The amount that was actually removed.
	 */
	int remove(ISoldier soldier, Integer amount);

	/**
	 * Adds a soldier to the troop.
	 * @param soldier Soldier type.
	 * @param amount Amount of units.
	 */
	void add(ISoldier soldier, Integer amount);

	/**
	 * Checks if a soldier type exists in the troop.
	 * @param s Soldier type.
	 * @return True if it exists, false if it doesn't.
	 */
	boolean contains(ISoldier s);
	
	/**
	 * Checks if a troop is defeated in a battle of not.
	 * @return True if troop is defeated, false if not.
	 */
	boolean isDefeated();

	/**
	 * Merge troops together to one on a single tile.
	 * @param t A second troop.
	 */
	void merge(ITroop t);

	/**
	 * Move the troop to another tile on the gameboard.
	 * @param newPosition New tile to move the troops to.
	 */
	void moveTo(ITile newPosition);

	/**
	 * Gets the amount of a certain soldier type.
	 * @param s Soldier type.
	 * @return Amount of the specified soldier type.
	 */
	int getAmount(ISoldier s);

	/**
	 * Gets the soldier types in the troop.
	 * @return Returns all soldier types in the troop.
	 */
	Set<ISoldier> getSoldiers();

	/**
	 * Adds a propertychangelistener.
	 * @param observer Propertychangelistener.
	 */
	void addPropertyChangeListener(PropertyChangeListener observer);

	/**
	 * Removes a propertychangelistener.
	 * @param observer Propertychangelistener.
	 */
	void removePropertyChangeListener(PropertyChangeListener observer);

	/**
	 * Gets soldier type for the troop.
	 * @return Soldier type.
	 */
	IType getSoldierType();

}